package com.ruoyi.web.controller.kiku;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kiku.domain.KikuSuperWords;
import com.ruoyi.kiku.service.IKikuSuperWordsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 超话信息Controller
 *
 * @author TT
 * @date 2025-08-03
 */
@RestController
@RequestMapping("/kiku/superWords")
public class KikuSuperWordsController extends BaseController
{
    @Autowired
    private IKikuSuperWordsService kikuSuperWordsService;

    /**
     * 查询超话信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuSuperWords kikuSuperWords)
    {
        startPage();
        List<KikuSuperWords> list = kikuSuperWordsService.selectKikuSuperWordsList(kikuSuperWords);
        return getDataTable(list);
    }

    /**
     * 导出超话信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:export')")
    @Log(title = "超话信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuSuperWords kikuSuperWords)
    {
        List<KikuSuperWords> list = kikuSuperWordsService.selectKikuSuperWordsList(kikuSuperWords);
        ExcelUtil<KikuSuperWords> util = new ExcelUtil<KikuSuperWords>(KikuSuperWords.class);
        util.exportExcel(response, list, "超话信息数据");
    }

    /**
     * 获取超话信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuSuperWordsService.selectKikuSuperWordsById(id));
    }

    /**
     * 新增超话信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:add')")
    @Log(title = "超话信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuSuperWords kikuSuperWords)
    {
        return toAjax(kikuSuperWordsService.insertKikuSuperWords(kikuSuperWords));
    }

    /**
     * 修改超话信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:edit')")
    @Log(title = "超话信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuSuperWords kikuSuperWords)
    {
        return toAjax(kikuSuperWordsService.updateKikuSuperWords(kikuSuperWords));
    }

    /**
     * 删除超话信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:superWords:remove')")
    @Log(title = "超话信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuSuperWordsService.deleteKikuSuperWordsByIds(ids));
    }
}
